package net.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "PESO_HECTOLITRICO")
public class PesoHectolitrico implements Serializable,
		Comparable<PesoHectolitrico> {

	private static final long serialVersionUID = -8699337056821918634L;

	@Id
	@Column(name = "uid")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Column(name = "area")
	private Double area;

	@Column(name = "peso_hectolitrico")
	private Double pesoHectolitrico;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Double getArea() {
		return area;
	}

	public void setArea(Double area) {
		this.area = area;
	}

	public Double getPesoHectolitrico() {
		return pesoHectolitrico;
	}

	public void setPesoHectolitrico(Double pesoHectolitrico) {
		this.pesoHectolitrico = pesoHectolitrico;
	}

	@Override
	public int compareTo(PesoHectolitrico ph) {
		if (this.area == ph.area) {
			return this.pesoHectolitrico.compareTo(ph.pesoHectolitrico);
		} else {
			return this.area.compareTo(ph.area);
		}
	}

}
